<%--
	fileName      : usermgmt_user_modify2.jsp
	author        : kfzx-liukai
	createDate    : 2010-6-3  上午07:28:19
	lastModifier  : kfzx-liukai
	lastModifyDate: 2010-6-3  上午07:28:19
	description   : 个人信息设置
--%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="ctp-tag" prefix="ctp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>个人信息设置</title>
		<ctp:include items='borderlayout,panel,toolbar,textfield,button,gridlayout,multiselect,combobox,form,validator,textarea,label,radiogroup,checkbox,vwizard,message_ex,datepicker,checkboxgroup'/>
		<script type="text/javascript" src="<ctp:out name='fullPath'/>js/ctp/validator/ctp.validator.js"></script>
        <script type="text/javascript" src="<ctp:out name='fullPath'/>js/ctp/validator/ctp.validator-rules.js"></script>
        <%@ include file="/systemgmt/authExt.jsp"%>
        <link href="<ctp:out name='fullPath'/>css/validator.css" rel="stylesheet" type="text/css"/>
		<script type='text/javascript' kind='variant'>	
			var borderlayout;
			var ctppanel1;
			var ctplightlayout1;
			var _mainlayout;	
			var ctpform1;
			
	    </script>
        <script type='text/javascript' kind='event'>
        //ctp.core.log.lvl = ctp.core.loglvl.obj;
        	//================================函数定义片段============================================================
			var ctpUserIdValue;
			var ctpUserNameValue;
			var ctpUserBranchValue;
			var ctpUserDesValue;
			var ctpUserPriValue;
			var ctpUserPhoneValue;			
			var ctpUserEmailValue;
			var ctpUserAddressValue;
			var ctpUserPostcodeValue;			
			var ctplastModifyUserValue;			
			var ctplastModifyDateValue;
			var ctpUserDefaultRole;
			var prigroup;	
			var extProperty='';	
			var ext_flag='0';
			var userId='<ctp:out name="userId" />';


				function setPriText(){
					var privilegeAll='<ctp:out name="userObj.privilegeAll" />';
					var privilegeSelf='<ctp:out name="userObj.privilegeSelf" />';
					var privilegeOther='<ctp:out name="userObj.privilegeOther" />';
					if(privilegeAll=='1'){
						prigroup='<ctp:label key="allbranch"/>';
					}
					else if(privilegeSelf=='1'){
						prigroup='<ctp:label key="selfbranch"/>';
						if(privilegeOther>0){
							prigroup=prigroup+' '+'<ctp:label key="can_manage" /><ctp:label key="underline" />'+privilegeOther+'<ctp:label key="level" />';
						}
					}
					else{
						prigroup='<ctp:label key="simple_user"/>';
					}
					
					ctpUserPriValue = new ctp.ui.label({
						id: 'UserPriValue',
				//		text: prigroup=='000'?'<ctp:label key="simple_user"/>':prigroup=='100'?'<ctp:label key="allbranch"/>':'<ctp:label key="selfbranch"/>',
		                text:prigroup,
			            width: '100%'
					});
				}

				
				ctpUserIdValue = new ctp.ui.label({
					id: 'userIdValue',
		            text: '<ctp:out name="userId" />',
		            width: '100%'
				});

				ctpUserNameValue = new ctp.ui.label({
					id: 'userNameValue',
		            text: '<ctp:out name="userObj.name" defaultValue="" />',
		            width: '100%'
				});

				ctpUserStatusValue = new ctp.ui.label({
					id: 'UserStatusValue',
					<ctp:if test="userObj.status==1"> 
	                text: '<ctp:label key="activate"/>'
	                </ctp:if>
	                <ctp:elseif test="userObj.status==0">
	                text: '<ctp:label key="freeze" />'
	                </ctp:elseif>,
		            width: '100%'                
				});

				ctpUserBranchValue = new ctp.ui.label({
					id: 'UserBranchValue',
	                text: '<ctp:out name="userObj.branchName" defaultValue="" />',
		            width: '100%'
				});

				ctpUserDesValue = new ctp.ui.label({
					id: 'UserDesValue',
	                text: '<ctp:out name="userObj.description" defaultValue="" />',
		            width: '100%'
				});
				


				ctpUserPhoneValue = new ctp.ui.label({
					id: 'UserPhoneValue',
	                text: '<ctp:out name="userObj.phoneNo" defaultValue="" />',
		            width: '100%'
				});

				ctpUserEmailValue = new ctp.ui.label({
					id: 'UserEmailValue',
	                text: '<ctp:out name="userObj.email" defaultValue="" />',
		            width: '100%'
				});

				ctpUserAddressValue = new ctp.ui.label({
					id: 'UserAddressValue',
	                text: '<ctp:out name="userObj.address" defaultValue="" />',
		            width: '100%'
				});

				ctpUserPostcodeValue = new ctp.ui.label({
					id: 'UserPostcodeValue',
	                text: '<ctp:out name="userObj.postcode" defaultValue="" />',
		            width: '100%'
				});

				ctplastModifyUserValue = new ctp.ui.label({
					id: 'UserlastModifyUserValue',
	                text: '<ctp:out name="userObj.lastModiUserId" defaultValue="" />',
		            width: '100%'
				});

				ctplastModifyDateValue = new ctp.ui.label({
					id: 'UserlastModifyDateValue',
	                text: '<ctp:out name="userObj.lastModiTime" defaultValue="" />',
		            width: '100%'
				});
				
				ctpUserDefaultRole= new ctp.ui.label({
					id: 'UserDefaultRole',
	                text: '<ctp:out name="userObj.userDefaultRole" defaultValue="" />',
		            width: '100%'
				});
				
				
			 /**
             * 填充扩展属性
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */		
			function initExt(){	
					 extProperty=ctp.data.getJSON('<ctp:url href="user.flowc" flowActionName="extqueryop"/>');//取得扩展属性	                 
			    	 if(extProperty.length>0){
			    	    if(extProperty[0].errorCode){ //查询扩展属性出错
                              ctpMSB.error({message:'<ctp:label key="query_user_extlist_error"/>,<ctp:label key="errorCode"/>:'+extProperty[0].errorCode+',<ctp:label key="errorMsg"/>:'+extProperty[0].errorMsg});
                        } 
			    	 	else{                	
				         	var count=extProperty[0].totalNum;
				         	if(count>0){
				         		ext_flag="1";
				         		ctpform1.setHiddenValue("ext_flag","1");//设置新增表单扩展属性标志          	                    	                       	
				         		$.each(extProperty, function(i, ext){
				           		     if(i>0){//忽略第一个数据totalNum
				               		     var extProId=ext.id;//扩展属性ID
				           		         var extProName=ext.name;//扩展属性名称
				           		         var extProTable=ext.table;//扩展表
				           		         var extProType=ext.type;//扩展属性类型,0：textfield，1：textarea，2：number，3：date，4：combobox，5：radiogroup，6：checkboxgroup 
				           		         
				           		         var extProDefaultValue=ext.defaultvalue;//缺省值，当属性为combobox、radiogroup、checkboxgroup 类型时，代表备选项，以分号";"分隔，放置在第一位的为缺省显示项 
				           		         var extProRequired=ext.required;//是否为必填，1：必填，0：可空
				           		         var extProDesc=ext.desc;//属性描述
				           		         var extProValidcheck=ext.validcheck;//合法性校验
				           		         var extProFormat=ext.format;//数据格式
				           		         cteateExtItem(ctpform1,_mainlayout,extProId,extProName,extProType,extProDefaultValue,extProRequired,extProDesc,extProValidcheck,extProFormat);
				     
				           		     }
				           	    });
				         	}else{
				         		ext_flag="0";
				         		ctpform1.setHiddenValue("ext_flag","0");//设置新增表单扩展属性标志
				         	}
				        	 if(ext_flag=="1"){//如果有扩展数据
						 	//var extData=ajaxRequest('<ctp:url href="user.flowc" flowActionName="queryUserExtData"/>&objId='+userIdSel);//取得角色表扩展属性数据
							    var extData=ctp.data.getJSON('<ctp:url href="user.flowc" flowActionName="queryUserExtData"/>&objId='+userId);
							    if(extData.length>0&& extData[0].errorCode){ //查询扩展属性数据出错
		                        		ctpMSB.error({message:'<ctp:label key="query_user_extdata_error"/>,<ctp:label key="errorCode"/>:'+extData[0].errorCode+',<ctp:label key="errorMsg"/>:'+extData[0].errorMsg});
								}
						 		
								 setExtValue(ctpform1,extProperty,extData);//设置扩展数据		      
						 	}
			        	 }
			  	  	 }	
			}			
        </script>
        
        <script type='text/javascript' kind='ui'>
		    //================================UI组件定义片段============================================================
		    //ctp.core.log.lvl = ctp.core.loglvl.obj; //需要进行调试时启用
		    /**
             * 创建UI组件
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */		 
			 function initUI(){

				   _mainlayout = new ctp.ui.gridlayout({
                    id: 'mainlayout',
                    cols: 1,
					width: '50%',
					align: 'center',
					colSpace: 30,
					defaults: {label:{width:'80px'}},
					items: [
						[{label:{id:'lbUserId',text:'<ctp:label key="user.userId.label"/><span style="color:red;">*</span>'+':'},element: ctpUserIdValue}],
						[{label:{id:'lbUserName',text:'<ctp:label key="user.userName.label"/><span style="color:red;">*</span>'+':'},element: ctpUserNameValue}],
						[{label:{id:'lbUserStatus',text:'<ctp:label key="user.userState.label"/><span style="color:red;">*</span>'+':'},element: ctpUserStatusValue}],
						[{label:{id:'lbUserBranch',text:'<ctp:label key="user.selBranch.label"/>'+':'},element: ctpUserBranchValue}],
						
						//[{label:{text:'<ctp:label key="userDefaultRole"/>'},element: ctpUserDefaultRole}],
						
						[{label:{id:'lbUserDes',text:'<ctp:label key="user.userDes.label"/>'+':'},element: ctpUserDesValue}],
						
						[{label:{id:'lbUserPri',text:'<ctp:label key="user.priOther.label"/>'+':'},element:ctpUserPriValue}],
	                	
						[{label:{id:'lbUserPhone',text:'<ctp:label key="user.userPhone.label"/>'+':'},element: ctpUserPhoneValue}],
						[{label:{id:'lbUserEmail',text:'<ctp:label key="user.userEmail.label"/>'+':'},element: ctpUserEmailValue}],
						[{label:{id:'lbUserAdderss',text:'<ctp:label key="user.userAddress.label"/>'+':'},element: ctpUserAddressValue}],
						[{label:{id:'lbUserPostcode',text:'<ctp:label key="user.userPostcode.label"/>'+':'},element: ctpUserPostcodeValue}],
						[{label:{id:'lblastModifyUser',text:'<ctp:label key="user.lastModifyUser.label"/>'+':'},element: ctplastModifyUserValue}],
						[{label:{id:'lblastModifyDate',text:'<ctp:label key="user.lastModifyDate.label"/>'+':'},element: ctplastModifyDateValue}]
					]
                });

			ctpform1 = new ctp.form({
		    	id: 'form1',
		        width: '100%', //宽度
		        height: '100%', //高度
	            items: [_mainlayout]
		    });
	                
			ctppanel1 = new ctp.ui.panel({
		        id:'ctppanel1Id',
		        style:'border',
		        height:'100%',
				items:[ctpform1],
		   		visible: 'auto'
		    });
						
			borderlayout = new ctp.ui.borderlayout({
                type: "1C",
                center__items:[ctppanel1],               
                renderTo:'body'
            });          
		};
	
       </script>
	</head>
	<body onload='setPriText();initUI();initExt();' >	

		<ctp:form name="form1" >
				<input type="hidden" name="ext_flag">
		</ctp:form>
	</body>
</html>

<%--
	date        :
	modifyReason:
--%>